Skip to content

Runtime async outlining prototype - #20746

Draft
majocha wants to merge 39 commits into
dotnet:mainfrom
majocha:runtime-async-core-outlining
Draft

majocha wants to merge 39 commits into
dotnet:mainfrom
majocha:runtime-async-core-outlining

Conversation

@majocha

@majocha majocha commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Outline inline functions that failed to inline into a runtime-async method. Alternative fix for #20577 (see also #20647).

majocha and others added 30 commits September 27, 2026 12:18
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Continue outlining past bindings that cannot be outlined, copy arguments
duplicated into match targets, restrict sequential handling to NormalSeq,
guard the outline walk against deep let chains, and share the Await
builder and match/quotation helpers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Outline suspending InlineIfLambda callbacks and prepare runtime-async bodies in a dedicated pass after the first optimization loop, so every body is prepared once in its final shape.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Outlined callbacks ran as separate runtime-async methods, so AsyncLocal writes they made were discarded on return. A callback selected by if/match is now constructed once, recording its branch and captures in locals, and each invocation dispatches to an inlined copy of the selected body.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Every invocation copies every branch body. Skip the rewrite when the copies would exceed 2000 expression nodes, leaving the callback as a closure so a remaining suspension is reported as FS3918. Add regression tests for callbacks constructed in a loop and nested branch-selected callbacks.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

✅ Release notes checked


✅ Found changes and release notes in following paths:

Warning

No PR link found in some release notes, please consider adding it.

Change path Release notes path Description
`src/FSharp.Core` docs/release-notes/.FSharp.Core/11.0.200.md No current pull request URL (#20746) found, please consider adding it
`src/Compiler` docs/release-notes/.FSharp.Compiler.Service/11.0.200.md No current pull request URL (#20746) found, please consider adding it

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

1 participant